home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / demo / igps_102.zip / MAINFRM.CPP < prev    next >
C/C++ Source or Header  |  1994-06-23  |  4KB  |  131 lines

  1. ////////////////////////////////////////////////////////////////////////////////////
  2. // Internet Global Phone Project
  3. // mainfrm.cpp : implementation of the CMainFrame class                             
  4. //
  5. // Very little modification to the AppWizard generated MFC skeleton.
  6. ////////////////////////////////////////////////////////////////////////////////////
  7. // Copyright (c) 1993-1994    microWonders Inc.  All rights reserved.
  8. //                                                                         
  9. // AN OPEN INVITION TO BUILD UPON AND CONTRIBUTE TO THE PUBLIC TECHNOLOGY POOL:
  10. // You are encouraged to redistribute, and build upon the technologies presented 
  11. // in this source module and the accompanying article in Dr. Dobb's Journal provided 
  12. // all the conditions listed in the MUSTREAD.TXT file, included with this 
  13. // distribution, are met.
  14. ////////////////////////////////////////////////////////////////////////////////////
  15.  
  16. #include "stdafx.h"
  17. #include "mphone.h"
  18.  
  19. #include "mainfrm.h"
  20.  
  21. #ifdef _DEBUG
  22. #undef THIS_FILE
  23. static char BASED_CODE THIS_FILE[] = __FILE__;
  24. #endif
  25.  
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CMainFrame
  28.  
  29. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  30.  
  31. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  32.     //{{AFX_MSG_MAP(CMainFrame)
  33.         // NOTE - the ClassWizard will add and remove mapping macros here.
  34.         //    DO NOT EDIT what you see in these blocks of generated code !
  35.     ON_WM_CREATE()
  36.     //}}AFX_MSG_MAP
  37.     // Global help commands
  38.     ON_COMMAND(ID_HELP_INDEX, CFrameWnd::OnHelpIndex)
  39.     ON_COMMAND(ID_HELP_USING, CFrameWnd::OnHelpUsing)
  40.     ON_COMMAND(ID_HELP, CFrameWnd::OnHelp)
  41.     ON_COMMAND(ID_CONTEXT_HELP, CFrameWnd::OnContextHelp)
  42.     ON_COMMAND(ID_DEFAULT_HELP, CFrameWnd::OnHelpIndex)
  43. END_MESSAGE_MAP()
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // arrays of IDs used to initialize control bars
  47.  
  48. // toolbar buttons - IDs are command buttons
  49. static UINT BASED_CODE buttons[] =
  50. {
  51.     // same order as in the bitmap 'toolbar.bmp'
  52. //    ID_FILE_NEW,
  53.     ID_FILE_OPEN,
  54. //    ID_FILE_SAVE,
  55. //        ID_SEPARATOR,
  56. //    ID_EDIT_CUT,
  57. //    ID_EDIT_COPY,
  58. //    ID_EDIT_PASTE,
  59. //        ID_SEPARATOR,
  60. //    ID_FILE_PRINT,
  61. //    ID_APP_ABOUT,
  62. //    ID_CONTEXT_HELP, 
  63.         ID_SEPARATOR,
  64.     ID_PHONE_RECORD,
  65.     ID_PHONE_SEND
  66. };
  67.  
  68. static UINT BASED_CODE indicators[] =
  69. {
  70.     ID_SEPARATOR,           // status line indicator
  71.     ID_INDICATOR_CAPS,
  72.     ID_INDICATOR_NUM,
  73.     ID_INDICATOR_SCRL,
  74. };
  75.  
  76. /////////////////////////////////////////////////////////////////////////////
  77. // CMainFrame construction/destruction
  78.  
  79. CMainFrame::CMainFrame()
  80. {
  81.     // TODO: add member initialization code here
  82. }
  83.  
  84. CMainFrame::~CMainFrame()
  85. {
  86. }
  87.  
  88. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  89. {
  90.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  91.         return -1;
  92.  
  93.     if (!m_wndToolBar.Create(this) ||
  94.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  95.         !m_wndToolBar.SetButtons(buttons,
  96.           sizeof(buttons)/sizeof(UINT)))
  97.     {
  98.         TRACE("Failed to create toolbar\n");
  99.         return -1;      // fail to create
  100.     }
  101.  
  102.     if (!m_wndStatusBar.Create(this) ||
  103.         !m_wndStatusBar.SetIndicators(indicators,
  104.           sizeof(indicators)/sizeof(UINT)))
  105.     {
  106.         TRACE("Failed to create status bar\n");
  107.         return -1;      // fail to create
  108.     }
  109.  
  110.     return 0;
  111. }
  112.  
  113. /////////////////////////////////////////////////////////////////////////////
  114. // CMainFrame diagnostics
  115.  
  116. #ifdef _DEBUG
  117. void CMainFrame::AssertValid() const
  118. {
  119.     CFrameWnd::AssertValid();
  120. }
  121.  
  122. void CMainFrame::Dump(CDumpContext& dc) const
  123. {
  124.     CFrameWnd::Dump(dc);
  125. }
  126.  
  127. #endif //_DEBUG
  128.  
  129. /////////////////////////////////////////////////////////////////////////////
  130. // CMainFrame message handlers
  131.